package com.lindroid.controller

import com.lindroid.entity.Resource
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Controller
import org.springframework.ui.ModelMap
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

//@RestController("ftl")
@Controller //使用RestController无法解析html
@RequestMapping("ftl")
class FreemarkerController {
    @Autowired
     lateinit var resource:Resource

    @RequestMapping("/index")
    fun index(map:ModelMap):String{
        //显示Resource里的内容
        map.addAttribute("resource",resource)
        return "freemarker/index"
    }

    @RequestMapping("/center")
    fun center(): String {
        return "freemarker/center/center"
    }

}